package com.huifer.wgx.model;

import java.sql.Timestamp;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * <p>Title : TaskEntity </p>
 * <p>Description : </p>
 *
 * @author huifer
 * @date 2019-03-20
 */
@Entity
@Table(name = "t_task", schema = "at15", catalog = "")
public class TaskEntity {

    private Long taskId;
    private String taskTitle;
    private String taskNote;
    private String taskIsok;
    private Long taskDoId;
    private Long taskAssignId;
    private Timestamp taskAssignTime;
    private Timestamp taskEndTime;
    private PersonnelEntity tPersonnelByTaskDoId;
    private PersonnelEntity tPersonnelByTaskAssignId;

    @Id
    @Column(name = "task_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getTaskId() {
        return taskId;
    }

    public void setTaskId(Long taskId) {
        this.taskId = taskId;
    }

    @Basic
    @Column(name = "task_title")
    public String getTaskTitle() {
        return taskTitle;
    }

    public void setTaskTitle(String taskTitle) {
        this.taskTitle = taskTitle;
    }

    @Basic
    @Column(name = "task_note")
    public String getTaskNote() {
        return taskNote;
    }

    public void setTaskNote(String taskNote) {
        this.taskNote = taskNote;
    }

    @Basic
    @Column(name = "task_isok")
    public String getTaskIsok() {
        return taskIsok;
    }

    public void setTaskIsok(String taskIsok) {
        this.taskIsok = taskIsok;
    }

    @Basic
    @Column(name = "task_do_id")
    public Long getTaskDoId() {
        return taskDoId;
    }

    public void setTaskDoId(Long taskDoId) {
        this.taskDoId = taskDoId;
    }

    @Basic
    @Column(name = "task_assign_id")
    public Long getTaskAssignId() {
        return taskAssignId;
    }

    public void setTaskAssignId(Long taskAssignId) {
        this.taskAssignId = taskAssignId;
    }

    @Basic
    @Column(name = "task_assign_time")
    public Timestamp getTaskAssignTime() {
        return taskAssignTime;
    }

    public void setTaskAssignTime(Timestamp taskAssignTime) {
        this.taskAssignTime = taskAssignTime;
    }

    @Basic
    @Column(name = "task_end_time")
    public Timestamp getTaskEndTime() {
        return taskEndTime;
    }

    public void setTaskEndTime(Timestamp taskEndTime) {
        this.taskEndTime = taskEndTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TaskEntity that = (TaskEntity) o;
        return Objects.equals(taskId, that.taskId) &&
                Objects.equals(taskTitle, that.taskTitle) &&
                Objects.equals(taskNote, that.taskNote) &&
                Objects.equals(taskIsok, that.taskIsok) &&
                Objects.equals(taskDoId, that.taskDoId) &&
                Objects.equals(taskAssignId, that.taskAssignId) &&
                Objects.equals(taskAssignTime, that.taskAssignTime) &&
                Objects.equals(taskEndTime, that.taskEndTime);
    }

    @Override
    public int hashCode() {
        return Objects
                .hash(taskId, taskTitle, taskNote, taskIsok, taskDoId, taskAssignId, taskAssignTime,
                        taskEndTime);
    }

    @ManyToOne
    @JoinColumn(name = "task_do_id", referencedColumnName = "personnel_id",insertable = false,updatable = false)
    public PersonnelEntity gettPersonnelByTaskDoId() {
        return tPersonnelByTaskDoId;
    }

    public void settPersonnelByTaskDoId(PersonnelEntity tPersonnelByTaskDoId) {
        this.tPersonnelByTaskDoId = tPersonnelByTaskDoId;
    }

    @ManyToOne
    @JoinColumn(name = "task_assign_id", referencedColumnName = "personnel_id",insertable = false,updatable = false)
    public PersonnelEntity gettPersonnelByTaskAssignId() {
        return tPersonnelByTaskAssignId;
    }

    public void settPersonnelByTaskAssignId(PersonnelEntity tPersonnelByTaskAssignId) {
        this.tPersonnelByTaskAssignId = tPersonnelByTaskAssignId;
    }
}
